package com.book.controller;


import com.book.pojo.RewardRanking;
import com.book.result.Result;
import com.book.service.RewardRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cxy
 * @since 2023-10-14 11:35:22
 */
@RestController
@RequestMapping("/reward-ranking")
public class RewardRankingController {

    @Autowired
    private RewardRankingService rewardRankingService;

    @GetMapping("RewardRanking")
    public Result RewardRanking(){
        List<RewardRanking> rewardRankings=rewardRankingService.RewardRanking();
        return Result.OK().setData(rewardRankings);
    }

    @DeleteMapping("deleteByBookId")
    public void deleteByBookId(@RequestParam Long BookId){
        rewardRankingService.deleteByBookId(BookId);
    }

    @PostMapping("addRewardRanking")
    public void addRewardRanking(@RequestParam RewardRanking ranking){
        rewardRankingService.addRewardRanking(ranking);
    }

}
